<?php

/**
 * ArticleArticle form base class.
 *
 * @package    form
 * @subpackage article_article
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseArticleArticleForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                  => new sfWidgetFormInputHidden(),
      'article_author_id'   => new sfWidgetFormInput(),
      'article_category_id' => new sfWidgetFormInput(),
      'title'               => new sfWidgetFormInput(),
      'summary'             => new sfWidgetFormTextarea(),
      'body'                => new sfWidgetFormTextarea(),
      'reference'           => new sfWidgetFormTextarea(),
      'view'                => new sfWidgetFormInput(),
      'download'            => new sfWidgetFormInput(),
      'wordcount'           => new sfWidgetFormInput(),
      'is_public'           => new sfWidgetFormInputCheckbox(),
      'is_activated'        => new sfWidgetFormInputCheckbox(),
      'is_featured'         => new sfWidgetFormInputCheckbox(),
      'activated_at'        => new sfWidgetFormDateTime(),
      'expires_at'          => new sfWidgetFormDateTime(),
      'slug'                => new sfWidgetFormInput(),
      'created_at'          => new sfWidgetFormDateTime(),
      'updated_at'          => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                  => new sfValidatorDoctrineChoice(array('model' => 'ArticleArticle', 'column' => 'id', 'required' => false)),
      'article_author_id'   => new sfValidatorInteger(),
      'article_category_id' => new sfValidatorInteger(),
      'title'               => new sfValidatorString(array('max_length' => 255)),
      'summary'             => new sfValidatorString(array('max_length' => 2147483647)),
      'body'                => new sfValidatorString(array('max_length' => 2147483647)),
      'reference'           => new sfValidatorString(array('max_length' => 2147483647, 'required' => false)),
      'view'                => new sfValidatorInteger(),
      'download'            => new sfValidatorInteger(),
      'wordcount'           => new sfValidatorInteger(),
      'is_public'           => new sfValidatorBoolean(),
      'is_activated'        => new sfValidatorBoolean(),
      'is_featured'         => new sfValidatorBoolean(),
      'activated_at'        => new sfValidatorDateTime(array('required' => false)),
      'expires_at'          => new sfValidatorDateTime(array('required' => false)),
      'slug'                => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'created_at'          => new sfValidatorDateTime(array('required' => false)),
      'updated_at'          => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorDoctrineUnique(array('model' => 'ArticleArticle', 'column' => array('slug')))
    );

    $this->widgetSchema->setNameFormat('article_article[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'ArticleArticle';
  }

}
